package util.texture.textureGenerators;

import util.Color4F;
import util.Vec2F;
public class GaussianTextureGenerator extends BaseFloatTextureDataGenerator
{
	float integral,variance;
	protected GaussianTextureGenerator(float integral,float variance)
	{
	    this.integral = integral;
	    this.variance = variance;
	}
	
	@Override
	protected Color4F texelValue(Vec2F location)
	{
		double coefficient = integral / (Math.sqrt(2.0 * Math.PI) * variance);
		double value = coefficient * Math.exp(-location.mag2()/(2 * variance * variance));
		
		return new Color4F((float)value,0f,0f,1f);
	}

}
